.class public Lcom/bitauto/autoeasy/bbs/Object/BbsCarTypeParser;
.super Ljava/lang/Object;
.source "BbsCarTypeParser.java"


# static fields
.field private static final BBSID:Ljava/lang/String; = "bbsid"

.field private static final BBSNAME:Ljava/lang/String; = "bbsname"

.field private static final ID:Ljava/lang/String; = "Id"

.field private static final IMAGE:Ljava/lang/String; = "Image"

.field private static final LOGO:Ljava/lang/String; = "logo"

.field private static final MEMBERCOUNT:Ljava/lang/String; = "membercount"

.field private static final NAME:Ljava/lang/String; = "Name"

.field private static final POSTS:Ljava/lang/String; = "posts"

.field private static final SERIALIST:Ljava/lang/String; = "SerialList"

.field private static final TOPICCOUNT:Ljava/lang/String; = "topiccount"


# instance fields
.field private TAG:Ljava/lang/String;

.field private list:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;",
            ">;"
        }
    .end annotation
.end field

.field private url:Ljava/lang/String;


# direct methods
.method public constructor <init>(Ljava/lang/String;)V
    .locals 1
    .parameter "url"

    .prologue
    .line 40
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 37
    const-string v0, ""

    iput-object v0, p0, Lcom/bitauto/autoeasy/bbs/Object/BbsCarTypeParser;->url:Ljava/lang/String;

    .line 38
    const-string v0, "BbsCarTypeParser"

    iput-object v0, p0, Lcom/bitauto/autoeasy/bbs/Object/BbsCarTypeParser;->TAG:Ljava/lang/String;

    .line 41
    iput-object p1, p0, Lcom/bitauto/autoeasy/bbs/Object/BbsCarTypeParser;->url:Ljava/lang/String;

    .line 42
    return-void
.end method

.method public static createBbsCarType(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;
    .locals 5
    .parameter "obj"

    .prologue
    .line 86
    new-instance v0, Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;

    invoke-direct {v0}, Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;-><init>()V

    .line 88
    .local v0, bbsCarType:Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;
    :try_start_0
    const-string v2, "bbsid"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;->setBbsid(Ljava/lang/String;)V

    .line 89
    const-string v2, "bbsname"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;->setBbsname(Ljava/lang/String;)V

    .line 90
    const-string v2, "Id"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;->setId(Ljava/lang/String;)V

    .line 91
    const-string v2, "logo"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;->setLogo(Ljava/lang/String;)V

    .line 92
    const-string v2, "membercount"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;->setMembercount(Ljava/lang/String;)V

    .line 93
    const-string v2, "posts"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;->setPosts(Ljava/lang/String;)V

    .line 94
    const-string v2, "topiccount"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;->setTopiccount(Ljava/lang/String;)V

    .line 95
    const-string v2, "Image"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;->setImage(Ljava/lang/String;)V

    .line 96
    const-string v2, "Name"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;->setName(Ljava/lang/String;)V
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    move-object v2, v0

    .line 101
    :goto_0
    return-object v2

    .line 98
    :catch_0
    move-exception v2

    move-object v1, v2

    .line 99
    .local v1, e:Lorg/json/JSONException;
    const-string v2, "BrandParser"

    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "error :"

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 100
    invoke-virtual {v1}, Lorg/json/JSONException;->printStackTrace()V

    .line 101
    const/4 v2, 0x0

    goto :goto_0
.end method

.method public static createBbsCarType2(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;
    .locals 5
    .parameter "obj"

    .prologue
    .line 112
    new-instance v0, Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;

    invoke-direct {v0}, Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;-><init>()V

    .line 114
    .local v0, bbsCarType:Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;
    :try_start_0
    const-string v2, "Image"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;->setImage(Ljava/lang/String;)V

    .line 115
    const-string v2, "Name"

    invoke-virtual {p0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;->setName(Ljava/lang/String;)V
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    move-object v2, v0

    .line 120
    :goto_0
    return-object v2

    .line 117
    :catch_0
    move-exception v2

    move-object v1, v2

    .line 118
    .local v1, e:Lorg/json/JSONException;
    const-string v2, "BrandParser"

    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "error :"

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 119
    invoke-virtual {v1}, Lorg/json/JSONException;->printStackTrace()V

    .line 120
    const/4 v2, 0x0

    goto :goto_0
.end method


# virtual methods
.method public Paser2Object()V
    .locals 14

    .prologue
    const-string v13, "error :"

    .line 50
    :try_start_0
    iget-object v10, p0, Lcom/bitauto/autoeasy/bbs/Object/BbsCarTypeParser;->url:Ljava/lang/String;

    invoke-static {v10}, Lcom/bitauto/autoeasy/tool/Caller;->doGet(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v9

    .line 51
    .local v9, str:Ljava/lang/String;
    new-instance v10, Ljava/util/ArrayList;

    invoke-direct {v10}, Ljava/util/ArrayList;-><init>()V

    iput-object v10, p0, Lcom/bitauto/autoeasy/bbs/Object/BbsCarTypeParser;->list:Ljava/util/ArrayList;

    .line 52
    new-instance v5, Lorg/json/JSONArray;

    invoke-direct {v5, v9}, Lorg/json/JSONArray;-><init>(Ljava/lang/String;)V

    .line 54
    .local v5, jArray:Lorg/json/JSONArray;
    const/4 v3, 0x0

    .local v3, i:I
    :goto_0
    invoke-virtual {v5}, Lorg/json/JSONArray;->length()I

    move-result v10

    if-lt v3, v10, :cond_0

    .line 77
    .end local v3           #i:I
    .end local v5           #jArray:Lorg/json/JSONArray;
    .end local v9           #str:Ljava/lang/String;
    :goto_1
    return-void

    .line 55
    .restart local v3       #i:I
    .restart local v5       #jArray:Lorg/json/JSONArray;
    .restart local v9       #str:Ljava/lang/String;
    :cond_0
    invoke-virtual {v5, v3}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v7

    .line 56
    .local v7, obj:Lorg/json/JSONObject;
    invoke-static {v7}, Lcom/bitauto/autoeasy/bbs/Object/BbsCarTypeParser;->createBbsCarType2(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;

    move-result-object v0

    .line 57
    .local v0, bbsCarType:Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;
    if-eqz v0, :cond_1

    .line 58
    iget-object v10, p0, Lcom/bitauto/autoeasy/bbs/Object/BbsCarTypeParser;->list:Ljava/util/ArrayList;

    invoke-virtual {v10, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 59
    :cond_1
    const-string v10, "SerialList"

    invoke-virtual {v7, v10}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v6

    .line 60
    .local v6, jArray2:Lorg/json/JSONArray;
    if-eqz v6, :cond_2

    .line 61
    const/4 v4, 0x0

    .local v4, j:I
    :goto_2
    invoke-virtual {v6}, Lorg/json/JSONArray;->length()I

    move-result v10

    if-lt v4, v10, :cond_3

    .line 54
    .end local v4           #j:I
    :cond_2
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    .line 62
    .restart local v4       #j:I
    :cond_3
    invoke-virtual {v6, v4}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v8

    .line 63
    .local v8, obj2:Lorg/json/JSONObject;
    invoke-static {v8}, Lcom/bitauto/autoeasy/bbs/Object/BbsCarTypeParser;->createBbsCarType(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;

    move-result-object v1

    .line 64
    .local v1, bbsCarType2:Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;
    if-eqz v0, :cond_4

    .line 65
    iget-object v10, p0, Lcom/bitauto/autoeasy/bbs/Object/BbsCarTypeParser;->list:Ljava/util/ArrayList;

    invoke-virtual {v10, v1}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
    .catch Lcom/bitauto/autoeasy/tool/WSError; {:try_start_0 .. :try_end_0} :catch_1

    .line 61
    :cond_4
    add-int/lit8 v4, v4, 0x1

    goto :goto_2

    .line 70
    .end local v0           #bbsCarType:Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;
    .end local v1           #bbsCarType2:Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;
    .end local v3           #i:I
    .end local v4           #j:I
    .end local v5           #jArray:Lorg/json/JSONArray;
    .end local v6           #jArray2:Lorg/json/JSONArray;
    .end local v7           #obj:Lorg/json/JSONObject;
    .end local v8           #obj2:Lorg/json/JSONObject;
    .end local v9           #str:Ljava/lang/String;
    :catch_0
    move-exception v10

    move-object v2, v10

    .line 71
    .local v2, e:Ljava/lang/Exception;
    iget-object v10, p0, Lcom/bitauto/autoeasy/bbs/Object/BbsCarTypeParser;->TAG:Ljava/lang/String;

    new-instance v11, Ljava/lang/StringBuilder;

    const-string v12, "error :"

    invoke-direct {v11, v13}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2}, Ljava/lang/Exception;->toString()Ljava/lang/String;

    move-result-object v12

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v11

    invoke-static {v10, v11}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 72
    invoke-virtual {v2}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_1

    .line 73
    .end local v2           #e:Ljava/lang/Exception;
    :catch_1
    move-exception v10

    move-object v2, v10

    .line 74
    .local v2, e:Lcom/bitauto/autoeasy/tool/WSError;
    iget-object v10, p0, Lcom/bitauto/autoeasy/bbs/Object/BbsCarTypeParser;->TAG:Ljava/lang/String;

    new-instance v11, Ljava/lang/StringBuilder;

    const-string v12, "error :"

    invoke-direct {v11, v13}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v2}, Lcom/bitauto/autoeasy/tool/WSError;->toString()Ljava/lang/String;

    move-result-object v12

    invoke-virtual {v11, v12}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v11

    invoke-virtual {v11}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v11

    invoke-static {v10, v11}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 75
    invoke-virtual {v2}, Lcom/bitauto/autoeasy/tool/WSError;->printStackTrace()V

    goto :goto_1
.end method

.method public getList()Ljava/util/ArrayList;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/bbs/Object/BbsCarType;",
            ">;"
        }
    .end annotation

    .prologue
    .line 45
    iget-object v0, p0, Lcom/bitauto/autoeasy/bbs/Object/BbsCarTypeParser;->list:Ljava/util/ArrayList;

    return-object v0
.end method
